<!--
	作者：2575202388@qq.com
	时间：2018-10-14
	描述：学生管理
-->

<template>
	<div style="width:100%;">
		<div style="background: #fff;">
			<div style="width:100%;float:left;padding-top: 10px;padding-bottom: 10px;">
				
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">登记年份：</div>
				<div style="width:8%;float:left;">
					<Select v-model="tj.bmsj" style="width:90%;float:left;" clearable>
				        <Option v-for="item in lisyear" :value="item" >{{ item }}</Option>
				    </Select>
				</div>
				
				<template v-if="user.CSID==null || user.CSID=='' ||  user.CSID==undefined">
					<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">学校：</div>
					<div style="width:12%;float:left;">
						<Select v-model="tj.csid" style="width:90%;float:left;" clearable>
					        <Option v-for="item in campus" :value="item.CSID" :key="item.CSNAME">{{ item.CSNAME }}</Option>
					    </Select>
					</div>
				</template>
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">报名号：</div>
				<div style="width:10%;float:left;">
					<Input v-model="tj.bmh"  clearable  style="width: 90%;float:left;" />
				</div>
				
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">学生姓名：</div>
				<div style="width:10%;float:left;">
					<Input v-model="tj.sname"  clearable  style="width: 90%;float:left;" />
				</div>
				
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">身份证号：</div>
				<div style="width:10%;float:left;">
					<Input v-model="tj.sfzh"  clearable  style="width: 90%;float:left;" />
				</div>
				
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">摇号状态：</div>
				<div style="width:10%;float:left;">
					<Select v-model="tj.sfbmcg" style="width:90%;float:left;" clearable>
				        <Option value="0">等待摇号中</Option>
				        <Option value="1">中签</Option>
				        <Option value="2">未中签</Option>
				    </Select>
				</div>
			</div>
			<div style="width:100%;float:left;padding-bottom: 10px;">
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">户籍所在地：</div>
				<div style="width:10%;float:left;">
    				<Select v-model="village" style="width:90%;float:left;" @on-change="gethjd" clearable>
				        <Option v-for="item in vills" :value="item.VAID" :key="item.VANAME">{{ item.VANAME }}</Option>
				    </Select>
				</div>
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">家长姓名：</div>
				<div style="width:10%;float:left;">
					<Input v-model="tj.jzxm"  clearable  style="width: 90%;float:left;" />
				</div>
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">家长手机：</div>
				<div style="width:10%;float:left;">
					<Input v-model="tj.jzsj"  clearable  style="width: 90%;float:left;" />
				</div>
				
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">年级：</div>
				<div style="width:10%;float:left;">
					<Select v-model="tj.rxnj" style="width:90%;float:left;" clearable>
				        <Option value="0">亲子班</Option>
				        <Option value="1">小班</Option>
				        <Option value="2">中班</Option>
				        <Option value="3">大班</Option>
				    </Select>
				</div>
				
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">初审状态：</div>
				<div style="width:10%;float:left;">
					<Select v-model="tj.ccsh" style="width:90%;float:left;" clearable>
				        <Option value="0">未审核</Option>
				        <Option value="1" >审核成功</Option>
					    <Option value="2" >初次审核失败</Option>
				    </Select>
				</div>
				
				<div style="text-align: right;float:left;line-height:32px;padding-left:10px;">初审失败原因：</div>
				<div style="width:10%;float:left;">
					<Select v-model="tj.sbyy" style="width:90%;float:left;" clearable>
				        <Option value="户口不在招生范围内，不能参与摇号" >户口不在招生范围内，不能参与摇号</Option>
				        <Option value="户口信息不详，请重新上传" >户口信息不详，请重新上传</Option>
				        <Option value="没上传户口本图片信息" >没上传户口本图片信息</Option>
				        <Option value="已取得其他幼儿园招生资格，不属于招生范围" >已取得其他幼儿园招生资格，不属于招生范围</Option>
				    </Select>
				</div>
			</div>
			
			<div style="width:100%;float:left;padding-bottom: 10px;">
				<div style="width:30%;text-align: left;float:left;">
					<Button v-on:click="search()" style="margin-left:1%;background: #ffa500;color:#fff;border:1px solid #ffa500;">搜索</Button>
					<Button @click="openexport" icon="ios-download-outline" type="primary" style="background-color: #ffffff;border:1px solid #ccc;color:#333;margin-right: 5px;">导出</Button>
	            	<Button v-on:click="importStudent()" icon="md-cloud-upload" type="primary" style="background-color: #8B8378;border:1px solid #8B8378;">导入摇号成功的学生</Button>
	            	<Button v-on:click="noticeStu()" icon="md-checkmark" type="primary" style="background-color: #42B983;border:1px solid #42B983;">摇号完成</Button>
				</div>
			</div>
			
		</div>
		<div>
			<ss :tj="tj" ref="studentss" ></ss>
		</div>
		<imports ref="importstudent" v-on:reload="search()"></imports>
		<bmcg ref="bmcg" v-on:reload="search()"></bmcg>
	</div>
</template>

<script>
	import ss from "./ss";
	import imports from "./import";
	import bmcg from "./bmcg";
	const _config = require('./../../../../../config/config')
	export default {
		name: "studentmanage",
		data() {
			return {
				tj: {
					csid:'',
					bmsj:'',//登记年份
					bmh:'',//报名号
					sname:'',//学生姓名
					sfzh:'',//身份证
					hjszd:'',//户籍所在地
					jzxm:'',//家长姓名
					jzsj:'',//家长手机
					sfbmcg:'',
					rxnj:'',//入学年级
					ccsh:'',//初审
					sbyy: ''
				},
				village:'',

				lisyear:[],
			}
		},
		methods: {
			search(){
				this.$refs.studentss.load();
			},
	        resettj(){
	        	this.tj.bmsj='';//登记年份
	        	this.tj.bmh='';
				this.tj.sname='';
				this.tj.sfzh='';
				this.tj.hjszd='';
				this.tj.jzxm='';
				this.tj.jzsj='';
				this.tj.sfbmcg='';
				this.tj.rxnj='';//入学年级
				this.tj.ccsh='';//初审
				this.tj.sbyy='';//初审
	        },
	        
	        importStudent(){
	        	this.$refs.importstudent.modal0=true;
	        },
	        
	        
	        gethjd(){
	        	this.tj.hjszd=this.village;
	        },
	  
	        
	        openexport(){
	        	var csid="";
	        	if(this.tj.csid){
	        		csid=this.tj.csid;
	        	}else{
	        		if(this.user.CSID){
	        			csid=this.user.CSID;
	        		}
	        	}
	        	
	        	var bmsj="";
	        	if(this.tj.bmsj){
	        		bmsj=this.tj.bmsj;
	        	}
	        	var bmh=this.tj.bmh;
				var sname=this.tj.sname;
				var sfzh=this.tj.sfzh;
				var hjszd=this.tj.hjszd;
				var jzxm=this.tj.jzxm;
				var jzsj=this.tj.jzsj;
				
				var sfbmcg="";
	        	if(this.tj.sfbmcg!=undefined && this.tj.sfbmcg!=null){
	        		sfbmcg=this.tj.sfbmcg;
	        	}
	        	
	        	var rxnj="";
	        	if(this.tj.rxnj!=undefined && this.tj.rxnj!=null){
	        		rxnj=this.tj.rxnj;
	        	}
	        	
				var ccsh="";
				if(this.tj.ccsh!=undefined && this.tj.ccsh!=null){
	        		ccsh=this.tj.ccsh;
	        	}
				
				var sbyy="";
				if(this.tj.sbyy!=undefined && this.tj.sbyy!=null){
					sbyy=this.tj.sbyy;
				}
				/* console.log(_config._ADMIN_SERVER+"/bmxt/student/export_Student.html?csid="+csid
				+"&bmsj="+bmsj
				+"&bmh="+bmh
				+"&sname="+sname
	        	+"&sfzh="+sfzh
				+"&hjszd="+hjszd
				+"&jzxm="+jzxm
				+"&jzsj="+jzsj
				+"&sfbmcg="+sfbmcg
				+"&rxnj="+rxnj
	        	+"&ccsh="+ccsh
				+"&sbyy="+sbyy
				) */
	        	window.open(_config._ADMIN_SERVER+"/bmxt/student/export_Student.html?csid="+csid
				+"&bmsj="+bmsj
				+"&bmh="+bmh
				+"&sname="+sname
	        	+"&sfzh="+sfzh
				+"&hjszd="+hjszd
				+"&jzxm="+jzxm
				+"&jzsj="+jzsj
				+"&sfbmcg="+sfbmcg
				+"&rxnj="+rxnj
	        	+"&ccsh="+ccsh
				+"&sbyy="+sbyy)
	        },
	        
	        noticeStu(){
	        	this.$refs.bmcg.modal0=true;
	        },
	        
		},
		components: {
			ss,
			imports,
			bmcg
		},
		mounted(){
			var lisyear=new Array();
			var dates = new Date();
			var nyear=dates.getFullYear(); 
			for(var i=0;i<5;i++){
				var y=parseInt(nyear)-i;
				lisyear.push(y);
			}
			this.lisyear=lisyear;
			this.tj.bmsj=nyear;
			if(this.user.CSID){
				this.tj.csid=this.user.CSID;
			}
		},
		watch:{
		},
		computed: {
			vills: function() {
				return this.$store.state.app.villsnb;
			},
			user: function() {
				return this.$store.state.app.user;
			},
			campus: function() {
				return this.$store.state.app.campus;
			}
		}
	}
</script>

<style>
	.ivu-cascader-menu{
		display: inline-block;
		min-width: 150px;
		height: 180px;
		margin: 0;
		padding: 5px 0 !important;
		vertical-align: top;
		list-style: none;
		border-right: 1px solid #e8eaec;
		overflow: auto;
	}
	
</style>